package com.xbongbong.saas.service;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.xbongbong.paas.pojo.FieldAttrEntityForImport;
import com.xbongbong.paas.pojo.dto.FormDataAddDTO;
import com.xbongbong.paas.pojo.dto.FormDataGetDTO;
import com.xbongbong.paas.pojo.dto.FormDataListDTO;
import com.xbongbong.paas.pojo.dto.ImportFormDataDTO;
import com.xbongbong.paas.pojo.dto.SaasFormSaveDTO;
import com.xbongbong.paas.pojo.dto.ValidateDataDTO;
import com.xbongbong.paas.pojo.imports.CellTitlePojo;
import com.xbongbong.paas.pojo.imports.RowGroupPojo;
import com.xbongbong.paas.toolbox.exception.XbbException;
import com.xbongbong.pro.businessdata.pojo.dto.FormatExplainDTO;
import com.xbongbong.pro.formdata.pojo.dto.SaasAnalysisDataDTO;
import com.xbongbong.pro.formexplain.pojo.dto.HandlerExplainInLinkItemDTO;
import com.xbongbong.pro.suppliercommunicate.pojo.dto.SupplierCommunicateDeleteBatchDTO;
import com.xbongbong.pro.suppliercommunicate.pojo.dto.SupplierCommunicateUpdateByBusinessRuleDTO;
import com.xbongbong.pro.suppliercommunicate.pojo.dto.SupplierDynamicAddDTO;
import com.xbongbong.pro.suppliercommunicate.pojo.vo.SupplierCommunicateDeleteBatchVO;
import com.xbongbong.pro.webdetail.pojo.vo.CommunicateDetailVO;
import com.xbongbong.pro.weblist.pojo.vo.CommunicateVO;

import java.util.List;

/**
 * @author long.rao
 * @version v1.0
 * @date 2019/1/29 11:25
 * @since v1.0
 */
public interface SupplierCommunicateService {
    /**
     * Description: 供应商跟进记录保存前校验
     * @param validateDataDTO saas特殊校验数据入参
     * @throws XbbException 业务异常
     * @author long.rao
     * @date 2019-01-22 10:34
     */
    void beforeSave(ValidateDataDTO validateDataDTO) throws XbbException;
    /**
     * Description: 供应商跟进记录保存后逻辑
     * @param saasFormSaveDTO saas保存数据
     * @throws XbbException 业务异常
     * @author long.rao
     * @date 2019-01-22 10:34
     */
    void afterSave(SaasFormSaveDTO saasFormSaveDTO) throws XbbException;

    /**
     * 新建时格式化解释
     *
     * @param formatExplainDTO 入参
     * @throws XbbException 异常
     * @author long.rao
     * @date 2019-02-13 20:53
     */
    void formatAddExplain(FormatExplainDTO formatExplainDTO) throws XbbException;

    /**
     * 供应商列表
     * @param formDataListDTO
     * @return
     */
    CommunicateVO list(FormDataListDTO formDataListDTO) throws XbbException;

    /**
     * 供应商详情
     * @param formDataGetDTO
     * @return
     */
    CommunicateDetailVO detail(FormDataGetDTO formDataGetDTO) throws XbbException;

    /**
     * 批量删除
     * @author 吴峰
     * @date 2019/3/26 10:38
     * @param supplierCommunicateDeleteBatchDTO
     * @return com.xbongbong.pro.suppliercommunicate.pojo.vo.SupplierCommunicateDeleteBatchVO
     * @throws XbbException 业务异常
     */
    SupplierCommunicateDeleteBatchVO deleteBatch(SupplierCommunicateDeleteBatchDTO supplierCommunicateDeleteBatchDTO) throws XbbException;


    /**
     * 关联新建格式化解释
     *
     * @param handlerExplainInLinkItemDTO 入参
     * @throws XbbException 异常
     */
    void formatLinkAddExplain(HandlerExplainInLinkItemDTO handlerExplainInLinkItemDTO) throws XbbException;

    /**
     * 将Excel数据格式化成表单保存需要的JSON格式的数据
     *
     * @param importFormDataDTO 导入入参
     * @param titlePojoList     标题
     * @param rowGroupPojo      一个表单对应的一组Excel填写的数据
     * @param fieldAttrList     解释
     * @return FormDataAddDTO
     * @throws XbbException XbbException
     */
    FormDataAddDTO formatExcelValue(ImportFormDataDTO importFormDataDTO, List<CellTitlePojo> titlePojoList, RowGroupPojo rowGroupPojo, List<FieldAttrEntityForImport> fieldAttrList) throws XbbException;

    void setCondition(FormDataListDTO formDataListDTO) throws XbbException;

    /**
     * 修改供应商名称
     * @author 吴峰
     * @date 2019/6/20 10:54
     * @param corpid 公司id
     * @param dataId 数据id
     * @param name 供应商名称
     * @return void
     * @throws XbbException 业务异常
     */
    void dataConsistencyUpdateSupplier(String corpid, Long dataId, String name) throws XbbException;

    /**
     * 根据业务规则，更新供应商跟进记录
     * @author 吴峰
     * @date 2019/8/19 15:16
     * @param communicateUpdateByBusinessRuleDTO
     * @return void
     * @throws XbbException 业务异常
     */
    void updateBatchByBusinessRule(SupplierCommunicateUpdateByBusinessRuleDTO communicateUpdateByBusinessRuleDTO) throws XbbException;


    /**
     * 供应商动态（项目日志）添加
     * @param supplierDynamicAddDTO 入参
     * @throws XbbException
     */
    void addSupplierDynamic(SupplierDynamicAddDTO supplierDynamicAddDTO) throws XbbException;

    void afterSaveForWorkflow(SaasFormSaveDTO saasFormSaveDTO) throws XbbException;

    void afterSaveForUpdateWorkflow(SaasFormSaveDTO saasFormSaveDTO) throws XbbException;
}
